<?php

class fb_categories {
    private static $_CATEGORIES = array();
    const PRODUCT_TYPE = 'product';
    const CATEGORY_TYPE = 'portobello:category';
    
    public function __construct() {
        $obj = new Category(fb_category_map::SALADS);
        $obj->set_name('salads')
            ->set_ezpageid(ezpage_category_map::SALADS)
            ->set_type(self::CATEGORY_TYPE)
            ->set_title('Salads')
            ->set_description('La descripcion de las ensaladas')
            ->set_image('/images/ensalada-atun-surimi.jpg')
            ->set_url('/salads');
        self::$_CATEGORIES[$obj->ezpageid()] = $obj;
          
        $obj = new Category(fb_category_map::FISHES);
        $obj->set_name('fishes')
            ->set_ezpageid(ezpage_category_map::FISHES)
            ->set_type(self::CATEGORY_TYPE)
            ->set_title('Fishes')
            ->set_description('La descripcion de los pescados')
            ->set_image('/images/ensalada-atun-surimi.jpg')
            ->set_url('/fishes');
        self::$_CATEGORIES[$obj->ezpageid()] = $obj;  
        
        $obj = new Category(fb_category_map::BEEFS);
        $obj->set_name('beefs')
            ->set_ezpageid(ezpage_category_map::BEEFS)
            ->set_type(self::CATEGORY_TYPE)
            ->set_title('Beefs')
            ->set_description('La descripcion de los bifes')
            ->set_image('/images/ensalada-atun-surimi.jpg')
            ->set_url('/beefs');
        self::$_CATEGORIES[$obj->ezpageid()] = $obj;  
        
        $obj = new Category(fb_category_map::OILS);
        $obj->set_name('oils')
            ->set_ezpageid(ezpage_category_map::OILS)
            ->set_type(self::CATEGORY_TYPE)
            ->set_title('Oils & Vinagers')
            ->set_description('La descripcion de los aceites y los vinagres')
            ->set_image('/images/ensalada-atun-surimi.jpg')
            ->set_url('/oils');
            
        self::$_CATEGORIES[$obj->ezpageid()] = $obj;
     }

    public function get($ezpageid) {
        return (isset(self::$_CATEGORIES[$ezpageid])) ? self::$_CATEGORIES[$ezpageid] : null; 
    }
    
    public function get_cats() {
        return self::$_CATEGORIES;
    }
}
